package com.vf.cloud.scene.mvc.ue.service.impl;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject;
import com.jfinal.kit.StrKit;
import com.vf.cloud.common.util.R;
import com.vf.cloud.scene.mvc.ue.service.IPOIService;
import com.vf.cloud.scene.mvc.ue.service.IUEService;

@Service
public class UEService implements IUEService{

	@Autowired
	private IPOIService iPOIService;
	
	@Override
	public R<Object> handle(String param) {
		
		if(StrKit.isBlank(param)) {
			return R.failed("参数必填.");
		}
		
		JSONObject jsonObject=JSONObject.parseObject(param);
		if(jsonObject==null) {
			return R.failed("参数必填.");
		}
		if(!jsonObject.containsKey("command")|| !jsonObject.containsKey("data")) {
			return R.failed("参数必填.");
		}
		String command=jsonObject.getString("command");
		String data=jsonObject.getString("data");
		
		JSONObject dataObject=JSONObject.parseObject(data);
		if(dataObject==null) {
			return R.failed("参数必填.");
		}
		
		if(StrKit.equals("GetPoiList",command)) {
			return iPOIService.findList(dataObject);
		}
		return R.failed("命令行无法识别.");
	}

}
